<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>借款详情</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/static/layuiAdmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/layuiAdmin/style/admin.css" media="all">
    <script src="/static/layuiAdmin/layui/layui.js"></script>
    <script src="/static/jquery/jquery-3.3.1.min.js"></script>
</head>
<body>
    <p style="text-align: center;font-size:18px;font-weight:500;margin-top:25px;">借款详情</p>
    <table class="layui-table">
        <tbody>
            <tr>
                <td>用户姓名</td>
                <td>{$orderData['TrueName']}</td>
            </tr>
            <tr>
                <td>借款金额</td>
                <td>{$orderData['ApplyMoney']}元</td>
            </tr>
            <tr>
                <td>借款期限</td>
                <td>{$orderData['ApplyDay']}天</td>
            </tr>
            <tr>
                <td>服务费用</td>
                <td>{$orderData['Interest']}元</td>
            </tr>
            <tr>
                <td>到账金额</td>
                <td>{$orderData['AdoptMoney']}元</td>
            </tr>
            <tr>
                <td>还款时间</td>
                <td>{$orderData['YyFkTime']}</td>
            </tr>
            <tr>
                <td>到期应还</td>
                <td>{$orderData['daoqiMoney']}元</td>
            </tr>
        </tbody>
    </table>
    <p style="text-align: center;line-height: 3em;">
        <input type="checkbox" id="inputStatus" name="" title="发呆" lay-skin="primary">
        <span>我已阅读并同意</span>
        <a href="javascript:;" id="lookAgreement" style="color:#0066cc;">《借款协议》</a>
    </p>
    <div style="text-align: center;margin-top:15px;">
        <button id="confirm" class="layui-btn layui-btn-primary " style="width: 25%;border-radius: 5px;">确认用款</button>
    </div>
</body>

<script>
	layui.config({
		base: '/static/layuiAdmin/' //静态资源所在路径
	}).extend({
		index: 'lib/index' //主入口模块
	}).use(['index', 'console','sample']);
</script>
<script>
    layui.use(['table','form','laydate'], function() {
        var table = layui.table;
        var form = layui.form;
        var laydate = layui.laydate;

        $("#lookAgreement").click(function(){
            var orderSn = "{$orderData['OrderSn']}";
            layer.open({
                type: 2
                ,title: ''
                ,content: '/api.php/lishidai/Agreement/loan?orderSn='+orderSn
                ,maxmin: true
                ,area:['90%','80%']
                ,shadeClose:true,
            });
        });
    });
</script>

<script>
    $("#confirm").click(function(){
        var orderId = "{$orderData['ID']}";
        var return_url = "{$return_url}";
        var isLoanAgree = 2;
        if(document.getElementsByTagName('input')[0].checked){
            isLoanAgree = 1;
        }
        $.ajax({
            type: 'post',
            url: "/api.php/lishidai/order/waitingConfirm",
            data: {
                'orderId': orderId,
                'isLoanAgree':isLoanAgree,
                'return_url':return_url
            },
            dataType: 'json',
            success: function(res) {
                if(res.code == 200) {
                    layer.msg(res.msg);
                    window.setTimeout(function() {
						window.location.href = res.data.url;
					}, 2000);
                }else {
                    layer.msg(res.msg);
                }
            }
        });
    });
</script>
</html>